package cn.ctodb.divination.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * A Bihua.
 */
@Entity
@Table(name = "bihua")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "bihua")
public class Bihua implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "num")
    private Integer num;

    @Lob
    @Column(name = "hanzi")
    private String hanzi;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getNum() {
        return num;
    }

    public Bihua num(Integer num) {
        this.num = num;
        return this;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getHanzi() {
        return hanzi;
    }

    public Bihua hanzi(String hanzi) {
        this.hanzi = hanzi;
        return this;
    }

    public void setHanzi(String hanzi) {
        this.hanzi = hanzi;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Bihua bihua = (Bihua) o;
        if (bihua.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, bihua.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Bihua{" +
            "id=" + id +
            ", num='" + num + "'" +
            ", hanzi='" + hanzi + "'" +
            '}';
    }
}
